﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Configuration;
using ExpertMIS.Entities;

namespace ExpertMIS.Codes
{
    public class AdminAuthenticationPage : SYS.Web.AuthenticationPage
    {
        public AdminAuthenticationPage()
        {
            //LoginURL = ConfigurationManager.AppSettings["DefaultLoginURL"] != null ?
            //ConfigurationManager.AppSettings["DefaultLoginURL"] : LoginURL;
        }

        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);
            // 应用主题(Theme)
            Theme = "Admin";
        }

        protected override bool CheckFeatureRights()
        {
            if (CurrentUser == null)
            {
                return false;
            }

            ADMUserEntity entity = CurrentUser as ADMUserEntity;
            if (entity != null && !entity.IsAdmin.Value)
            {
                return false;
            }

            return true;
        }
    }
}
